package day_2022_4_to_7.day48;

import java.util.*;

/**
 * @author haomin
 * @date 2022/05/18 10:48
 **/
public class Day21_1_ShuffleTheCards {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int groups = sc.nextInt();
        while (groups-- > 0) {
            // 每个手手牌个数
            int n = sc.nextInt();
            // 交换次数
            int k = sc.nextInt();
            int[] res = new int[2 * n];
            for (int i = 0; i < 2 * n; i++) {
                int tmp = i + 1;
                for (int j = 0; j < k; j++) {
                    if (tmp <= n) {
                        tmp = 2 * tmp - 1;
                    }
                    else {
                        tmp = 2 * (tmp - n);
                    }
                }
                res[tmp - 1] = sc.nextInt();
            }
            //输出
            for (int i = 0; i < 2 * n; i++) {
                if(i != 2*n-1){
                    System.out.print(res[i] + " ");
                }else {
                    System.out.println(res[i]);
                }
            }
        }
    }
}